package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] arr = {"one","two","three","four","five"};
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        for (String str:arr){
            System.out.println(str);
        }
        System.out.println("-----------------------");
        Collection<String> arr1=new ArrayList<>();
        arr1.add("one");
        arr1.add("two");
        arr1.add("three");
        arr1.add("four");
        arr1.add("five");
        Iterator<String> it=arr1.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (String atr:arr1){
            System.out.println(atr);
        }
    }
}
